package com.itserver.aop;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
//@Aspect // 切面类
@Component
//定义切面类
public class RecordTimeAspect {
    @Around("execution(* com.itserver.service.sys.impl.*.*(..))")
    public Object recordTime(ProceedingJoinPoint pjp) throws Throwable {
        long start = System.currentTimeMillis();
        Object result = pjp.proceed();
        long end = System.currentTimeMillis();
        log.info("开始时间：{}", start);
        log.info("结束时间：{}", end);
        log.info("执行时间：{}", end - start);
        return result;
    }
}
